<template>
	<div>
		<a-form-model ref="ruleForm" :model="editForm">
			<a-form-model-item has-feedback label="用户留言基本信息">
				<h4>
					留言标题：{{editForm.title}} <br>
					留言人：{{editForm.name}} <br>
					联系方式：{{editForm.contact}} <br>
					留言日期：{{editForm.createTime}} <br>
					更新日期：{{editForm.updateTime}} <br>
					留言内容：</h4>
				<a-input v-model="editForm.content" disabled type="textarea" />
			</a-form-model-item>
			<a-divider></a-divider>
			<a-form-model-item has-feedback label="回复信息" prop="replyMsg">
				<a-input v-model="editForm.replyMsg" type="textarea" disabled/>
			</a-form-model-item>
			<a-form-model-item has-feedback label="留言板状态" prop="status">
				<a-tag v-if="editForm.status === 0" color="#3973d0">
					审核中
				</a-tag>
				<a-tag v-if="editForm.status === 1" color="#87d068">
					审核通过
				</a-tag>
				<a-tag v-if="editForm.status === 2" color="#733ed0">
					已回复
				</a-tag>
			</a-form-model-item>
		</a-form-model>
	</div>
</template>

<script>
	import {getBoardById} from '@/api/System.js'
	export default {
		name: 'MsgBoardDetail',
		props: ['id'],
		data () {
			return {
				editForm: {
					id: this.id
				}
			}
		},
		created() {
			this.getMsgBoardById(this.editForm.id)
		},
		methods: {
			async getMsgBoardById (id) {
				const {data : res} = await getBoardById(id)
				if (res.code !== 20005)
					return this.$message.error('加载留言板出错')
				this.editForm = res.data
				this.$message.success(res.msg)
			},
		}
	}
</script>

<style>
</style>
